package com.shao.controller;

import com.shao.common.R;
import com.shao.common.stuIfo;
import com.shao.common.updateStuInfoVo;
import com.shao.service.stuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: com.song shao
 * @date: 2022/2/28
 * @time: 18:45
 * @version: 1.0
 */
@SuppressWarnings("all")
@RestController
@RequestMapping("/tea")
public class teacherController {
    @Autowired
    private stuService stu;

    /**
     * 教师查询学生
     *
     * @return
     */
    @PostMapping("/findStu")
    public R teacherFindStudent() {
        List<stuIfo> resu = stu.teacherFindStudent();
        return resu != null ? R.success(resu) : R.error("你的网络有问题！");
    }

    /**
     * 更新学生成绩
     *
     * @return
     */
    @PostMapping("/updateStuInfo")
    public R updateStuInfo(@RequestBody updateStuInfoVo usi) {
        boolean resu = stu.updateStuInfo(usi);
        return resu ? R.success(resu) : R.error("你的网络有问题！");
    }
}
